package oa.service.impl;

import java.util.List;

import oa.dao.DepartmentDao;
import oa.dao.impl.DepartmentDaoImpl;
import oa.entity.Department;
import oa.exception.DaoException;
import oa.service.DepartmentService;

public class DepartmentServiceImpl implements DepartmentService {

	DepartmentDao departmentDao = new DepartmentDaoImpl();
	@Override
	public boolean addDepartment(Department department) throws DaoException {
		return departmentDao.addDepartment(department);
	}

	@Override
	public List<Department> selectAllDepartment( int companyid,Integer pageNo, Integer row){
		try {
			return departmentDao.selectAllDepartment(companyid,pageNo,row);
		} catch (DaoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public List<Department> selectDepartment(int departmentId, String departmentName, int companyId) {
		try {
			return departmentDao.selectDepartment(departmentId, departmentName, companyId);
		} catch (DaoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public boolean updateDepartment(Department department) throws DaoException {
		return departmentDao.updateDepartment(department);
	}

	@Override
	public boolean deleteCompany(int departmentId) throws DaoException {
		return departmentDao.deleteCompany(departmentId);
	}

	@Override
	public int countDepartment(int departmentId) throws DaoException {
		
		return departmentDao.countDepartment(departmentId);
	}

}
